package com.groupfour.attendancemanagementsystem.dao;

import com.groupfour.attendancemanagementsystem.entity.DO.AnswerDO;
import com.groupfour.attendancemanagementsystem.entity.DO.HomeworkDO;
import com.groupfour.attendancemanagementsystem.entity.DO.ProjectGroupDO;
import com.groupfour.attendancemanagementsystem.entity.DO.StudentDO;
import com.groupfour.attendancemanagementsystem.entity.DTO.*;
import com.groupfour.attendancemanagementsystem.entity.VO.HomeworkVO;
import com.groupfour.attendancemanagementsystem.entity.VO.RHomeworkVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;


@Mapper
public interface HomeworkDao {
    //学生
    /**
     * @author： oker
     * @describe： 根据表单选择情况查询作业信息
     */
    List<HomeworkVO> queryHomeworkByHomeworkDTO(HomeworkDTO homeworkDTO);

    //通过课程名查询单个课程的所有作业
    List<HomeworkVO> selectHomeworkByCourseName(@Param("courseName") String courseName);

    //学生某一作业详情
    List<HomeworkVO> selectHomeworkDetail(AnswerDetailsDTO answerDetailsDTO);

    //完成作业
    int finishHomework(AnswerDO answerDO);

    /**
     * @describe：表单可选结果集
     */
    //项目名称表单
    List<HomeworkDO> selectCourseName();

    //实训老师表单
    List<HomeworkDO> selectTeacherName();

    //小组选择表单
    List<ProjectGroupDO> selectGroupCode();

    //作业主题选择表单
    List<HomeworkDO> selectHomeworkTheme();
    // 教师
    /**
     * 下发作业
     */

    //下发作业
    int issueHomework(CHomeworkDTO cHomeworkDTO);

    //向 group_homework表 插入小组与作业映射关系
    int insertGroupCodeAndHomeworkCode(@Param("homeworkCode") String homeworkCode,ProjectGroupDO groupCode);

    //向 answer表 插入homeworkCode与StudentCode的关系
    int insertStudentAnswer(@Param("homeworkCode") String homeworkCode,StudentDO studentCode);

    //通过学生姓名查询学生学号
    StudentDO findStudentCodeByStudentName(@Param("studentName")String studentName);

    //通过小组名查询对应小组编号
    ProjectGroupDO findGroupCodeByGroupName(@Param("groupName")String groupName);

    //修改作业
    int updateHomework(HomeworkDO homeworkDO);

    //批改作业
    int replyHomeworkBy(AnswerDO answerDO);


    /**
     * @author 卑微小峰
     * @param homeworkCode
     * @return
     * @describe 教师根据作业编号删除作业（逻辑删）
     */
    int deleteHomeworkByHomeworkCode(@Param("homeworkCode") String homeworkCode);

    /**
     * @author 卑微小峰
     * @param rHomeWorkVO
     * @return
     * @describe 教师查询作业
     */
    List<RHomeworkVO> selectAllHomework(RHomeworkDTO rHomeWorkVO);



}